create sequence elema_sql01;

create sequence elema_sql02;

create sequence elema_sql03;
DROP SEQUENCE elema_sql03;

create table merchant
(
	mId number primary key,
	mPersonName varchar2(15),
	mTel varchar2(11),
	mIdCard varchar2(18),
	mCardPath varchar2(200),
	mLocation varchar2(200),
	mBrand varchar2(100),
	mLogoPath varchar2(200),
	mPassword varchar2(20)
);

create table food 
(
	fId number primary key,
	fName varchar2(50),
	mId number,
	fPrice number(7,2),
	fViewPath varchar2(200)
)

create table permission
(
	mId number,
	mStatus number
)

alter table merchant add constraint merchant_mTel_uk unique (mTel);  

insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'kinva','13123456789','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','DongAnCun','mdzz','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'kinva1','14123456789','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','DongAnCun','mdzz','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'kinva2','15123456789','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','DongAnCun','mdzz','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'kinva3','17123456789','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','DongAnCun','mdzz','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'kinva4','18123456789','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','DongAnCun','mdzz','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'kinva5','13123456780','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','DongAnCun','mdzz','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');

insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'renee1','12987654321','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','reneeAddress1','reneeHome1','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'renee2','13987654321','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','reneeAddress2','reneeHome2','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');
insert into MERCHANT (mid, mPersonName, mTel, mIdCard, mCardPath, mLocation, mBrand, mLogoPath, mPassword)
values (elema_sql01.nextval, 'renee3','14987654321','123456789012345678','http://www.005.tv/uploads/allimg/160617/1P3391451-3.jpg','reneeAddress3','reneeHome3','http://v1.qzone.cc/avatar/201509/12/14/39/55f3c89444771363.jpeg%21200x200.jpg','123456');

delete from MERCHANT where mid = 7;

update merchant set mLocation='ruanjianyuan',mBrand='miedingzhizai',mLogoPath='http://img5.duitang.com/uploads/item/201512/16/20151216202421_ma3dT.jpeg',mPassword='12345' where mid=5;

select * from merchant where mTel = '13123456789';

select * from merchant where mId=1 

insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin', 1, 12.34, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');

insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin', 1, 12.34, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');
insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin', 1, 12.3, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');
insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin1', 1, 12.35, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');
insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin', 2, 16.34, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');
insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin1', 2, 18.34, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');
insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'rubbishBin1', 2, 12.34, 'http://www.zsacg.com/data/attachment/portal/201506/23/210438h82jnhkgur6p81gg.jpg');



insert into FOOD (fid,fName, mId, fPrice, fViewPath)
values (elema_sql02.nextval,'goutou', 1, 100.47, 'http://cdn.duitang.com/uploads/item/201411/14/20141114215821_YHicH.jpeg');

insert into permission ( mid, mStatus)
values (1,1);
insert into permission ( mid, mStatus)
values (2,1);
insert into permission ( mid, mStatus)
values (3,1);
insert into permission ( mid, mStatus)
values (4,1);
insert into permission ( mid, mStatus)
values (43,1);



alter table MERCHANT
add (hh number);

alter table MERCHANT
drop column hh;

alter table MERCHANT
drop column mStatus;

select * from merchant;

select * from FOOD ;

select * from permission;











